#ifndef REGWIDGET_H
#define REGWIDGET_H

#include <QWidget>
#include "QThread/camerathread.h"
#include <QDateTime>
#include <baiduai.h>
#include <QMessageBox>
#include "model/user_model.h"

const QString baiduRegUrl = "https://aip.baidubce.com/rest/2.0/face/v3/faceset/user/add?access_token=%1";

namespace Ui {
class RegWidget;
}

class RegWidget : public QWidget
{
    Q_OBJECT

public:
    explicit RegWidget(QWidget *parent = nullptr);
    ~RegWidget();
    //向百度AI添加人脸
    bool addFaceToUser(const QString &accessToken, const QString &userId, const QString &groupId, const QByteArray &imgBase64);


private slots:
    //接受图片--接着双缓冲
    void receiveImg(QImage);

    void on_pushButton_clicked();

    void on_pushButton_2_clicked();

private:
    Ui::RegWidget *ui;
    QPointer<CameraThread> cameraThread; // 声明 QPointer
    QImage img; //接受摄像头线程发送来的画面

    // QWidget interface
protected:
    void paintEvent(QPaintEvent *event);
signals:
    void backToLogin(); //返回登录界面
};

#endif // REGWIDGET_H
